package com.wr.ChickenRabbit;

import java.util.Scanner;

/**
 * @Slogan: 哆啦A梦的口号你忘了么 ？
 * 生活百般滋味，人生需要笑对！！！
 */
public class Test {
    int head;
    int leg;
    int chickenNumb = 0;
    int rabbitNumb = 0;


    public Test(int head,int leg) {
//        System.out.print("请输入头的数量：");
        this.head = head;
//        System.out.print("请输入腿的数量：");
        this.leg = leg;
    }

    public void count(){
        // head == chickenNumb + rabbitNumb
        // leg == chickenNumb*2 + rabbitNumb *4
        // chickenNumb == 2* head - leg/2
        // rabbitNumb == head - chickenNumb
        if(leg%2>0){
            chickenNumb = 2* head - leg/2;
            rabbitNumb = head - chickenNumb;

            if (chickenNumb>0 && rabbitNumb>0){
                System.out.println(chickenNumb);
                System.out.println(rabbitNumb);

            }else {
                System.out.println("不存在！");
            }
        }else {
            System.out.println("不存在！");
        }



    }






}
